<?php require_once('../session/auth.php'); ?>
<?php include '../config/config.php'; ?>
<!DOCTYPE html>
<html>
	<head>
		<title><?php echo HOMEPAGE; ?></title>
		<link href="../style.css" rel="stylesheet" type="text/css" media="screen" />
		<script src="../js/jquery-1.10.0.min.js"></script>
		<script src="../js/nicEdit.js"></script>
		<script type="text/javascript">
			bkLib.onDomLoaded(function() { nicEditors.allTextAreas() });
			$('.nicEdit-main').addClass('asdasdsad');
			
		</script>

		<script>
		$(document).ready(function(){

			$('body').on('click', '.btn', function(){
				var header_val = $('.banner_header').val();
				var contentitle_val = $('.content_title').val();
				var content_val = $('.main_content').val();
			
			 if(header_val != "" && contentitle_val != "" && content_val != "") {
					$.ajax({
						type:'POST',
						url:'processhome.php',
						data:{action: "updateInsert", value1:header_val, value2:contentitle_val, value3:content_val},
						success: function(data){
							alert('success');
							homepage();
						}
					});
				}

			});
				function homepage()
  				{
	  				setTimeout(function(){
	  					window.location.assign('http://localhost/simple/')
	  				},1000);
  				}

		});
		</script>
	</head>
	<body>	
		<?php 
			
			$sql = "SELECT * FROM $tbl_name";
			$r = mysql_query($sql);
			$rows = mysql_fetch_array($r);
			$result=mysql_query($sql);
		?>
		<div class="cont">
			<h1 style="text-align:center; color:#FFF;"><?php echo HOMEPAGE; ?></h1>
			<span><a href="../logout.php">Logout</a></span>
				<p>BANNER HEADER</p>
				<textarea name="banner_header" class="banner_header"><?php echo $rows['header'];?></textarea>
				<p>CONTENT TITLE</p>
				<textarea  name="content_title" class="content_title"><?php echo $rows['contenttitle'];?></textarea>
				<p>CONTENT</p>
				<textarea name="content" class="main_content"><?php echo $rows['content'];?></textarea>
				<div class="btn">Update</div>
		</div>
	
	</body>
</html>
